/<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(itme, index) in totalNum" :key="index">
        <van-grid :column-num="5">
          <van-grid-item
            v-for="(value, i) in 10"
            :key="value"
            :icon="list[index * 10 + i] ? list[index * 10 + i].img : ''"
            :text="list[index * 10 + i] ? list[index * 10 + i].title : ''"
          />
        </van-grid>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      list: [],
      totalNum: 0,
    };
  },
  //感觉这个一般就是用来引用现成儿的东西 比如:axios Vue.bus.$emit
  mounted() {
    axios.get("/list").then(res=> {
      this.list = res.data;
      this.totalNum = Math.ceil(res.data.length / 10);
    });
  },
};
</script>

<style>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>